package com.edu.service.impl;

import com.edu.bean.User;
import com.edu.mapper.UserMapper;
import com.edu.service.UserService;
import com.github.pagehelper.PageInterceptor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public int userRegister(User user) {
        if(userMapper.selectUser(user.getUsername()) != null){
            return -1;
        }else{
            return userMapper.insert(user);
        }
    }

    @Override
    public int userLogin(User user) {
        if(userMapper.selectUser(user.getUsername())==null){
            return -1;
        }else{
            return userMapper.selectUserByUserNameAndPassword(user) != null ? 1:0;
        }
    }

}
